﻿@{
    ViewBag.Title = "Customer Control Panel";
}
@using SAD_SiS.Models
@model Customer
<!-- begin test accordion -->
<link rel="stylesheet" href="@Url.Content("~/Content/css/jquery-ui.css")"/>
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery-ui.js")"></script>
<script type="text/javascript">
    $(function () {
        $("#accordion").accordion({
            fillSpace: true,
            autoHeight: true,
            navigation: false,
            collapsible: true
        });
    });
</script>
<!-- end -->
<style type="text/css">
    .Title_menu
    {
        text-align: right;
        font-weight: bold;
        line-height: 20px;
        color: inherit;
    }
</style>
<h2>
    CustomerCP</h2>
<table class="table table-hover" style="width: 100%;">
    <tr>
        <td rowspan="6" style="width: 430px; text-align: center;">
            <!-- <img alt="" src="../../Content/images/default_avatar.jpg" height="200px" width="200px" /> -->
            @if (Model.Avatar == null || File.Exists(Server.MapPath("~/Content/images/" + Model.Avatar)) == false)
            {
                Model.Avatar = "default_avatar.jpg";
            }
            <img alt="" src="@Url.Content("~/Content/images/" + Model.Avatar)" height="200px" width="200px" />
        </td>
        <td style="width: 100px" class="Title_menu">
            Tên tài khoản
        </td>
        <td>
            @Model.Username
        </td>
    </tr>
    <tr>
        <td class="Title_menu">
            Email
        </td>
        <td>
            @Model.Account.Email
        </td>
    </tr>
    <tr>
        <td class="Title_menu">
            Ngày tham gia
        </td>
        <td>
            @Model.Account.CreatedDate
        </td>
    </tr>
    <tr>
        <td class="Title_menu">
            Điện thoại
        </td>
        <td>
            @Model.Phone
        </td>
    </tr>
    <tr>
        <td class="Title_menu">
            Ngày sinh
        </td>
        <td>
            @Model.BirthDate.Value.ToShortDateString()
        </td>
    </tr>
    <tr>
        <td class="Title_menu">
            Địa chỉ
        </td>
        <td>
            @Model.Street , @Model.District
        </td>
    </tr>
    <tr>
        <td style="text-align: center;">
            <a href="@Url.Action("UpdateInfo", "Customer", new { strUsername = Model.Username }, null)">
                    Thay đổi thông tin</a> | <a href="@Url.Action("ChangePassword", "Customer", new { strUsername = Model.Username }, null)">
                        Đổi mật khẩu</a>
        </td>
        <td>
        </td>
        <td>
            &nbsp;
        </td>
    </tr>
</table>


<div id="accordion">
    <h3>
        Avatar</h3>
    <div>
        @Html.Partial("ChangeAvatar")
    </div>
    <h3>
        Danh sách hóa đơn</h3>
    <div>
        @using (SADEntities dbContext = new SADEntities())
        {
            var lstOrder = (from order in dbContext.Orders where order.Username == Model.Username select order).ToList();
            <table class="table table-bordered table-hover" width="100%">
                <tr>
                    <th>
                        ID
                    </th>
                    <th>
                        Day
                    </th>
                    <th>
                        Total
                    </th>
                    <th>
                        Status
                    </th>
                    <th>
                    </th>
                </tr>
                @foreach (var item in lstOrder)
                {
                    <tr>
                        <td>
                            @item.OrderID
                        </td>
                        <td>
                        @item.RequestDate
                        </td>
                        <td>@item.Total
                        </td>
                        <td>@item.status
                        </td>
                        <td>
                            <a class="btn btn-info" href="#">Chi tiết</a>
                        </td>
                    </tr>

                }
            </table>
        }
    </div>
        
</div>




